package cn.zl.systemb.config;

import cn.zl.ssoserver.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description:拦截器配置
 * @Author: zllwsy
 * @Date: 2020/11/6 14:23
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    //所要拦截的请求路径
    String[] addPathPatterns = {
            "/**"
    };

    //不需要拦截的请求路径
    String[] excludePathPatterns = {
            "/user/error","/user/out"
    };

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor()).addPathPatterns(addPathPatterns).excludePathPatterns(excludePathPatterns);
    }
}
